Skip to content

test: prevent virtualenvwrapper temp directory collisions (Fixes #498) - #499

Merged
Karthik Nadig (karthiknadig) merged 2 commits into
mainfrom
test/issue-498
Aug 5, 2026
Merged

test: prevent virtualenvwrapper temp directory collisions (Fixes #498)#499
Karthik Nadig (karthiknadig) merged 2 commits into
mainfrom
test/issue-498

Conversation

@karthiknadig

Copy link
Copy Markdown
Member

Summary

  • retain timestamp and process ID uniqueness for virtualenvwrapper test directories
  • add a process-local atomic sequence so parallel tests cannot collide at coarse clock resolution
  • preserve existing explicit cleanup behavior

Validation

  • 20 consecutive cargo test -p pet-virtualenvwrapper --lib --quiet runs
  • cargo test -p pet-virtualenvwrapper --lib
  • .\scripts\rust-precommit.ps1

Fixes #498

Combine timestamp, process ID, and an atomic sequence so parallel tests cannot share cleanup paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Test Coverage Report (Linux)

Metric Value
Current Coverage 80.6%
Base Branch Coverage 80.5%
Delta .1% ✅

Coverage increased! Great work!

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Performance Report (macOS)

Metric PR (P50) PR (P95) Baseline (P50) Delta
Server Startup 63ms 2330ms 69ms -6ms
Full Refresh 98ms 30290ms 118ms -20ms

Results based on 10 iterations. P50 = median, P95 = 95th percentile.


Legend
  • 🚀 Significant speedup (>100ms faster)
  • ✅ Faster than baseline
  • ➖ No significant change
  • 🔺 Slower than baseline (>100ms)
  • ⚠️ Significant slowdown (>500ms)

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Test Coverage Report (Windows)

Metric Value
Current Coverage 77.52%
Base Branch Coverage 77.31%
Delta 0.21% ✅

Coverage increased! Great work!

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Performance Report (Windows) ✅

Metric PR (P50) PR (P95) Baseline (P50) Delta Change
Server Startup 8ms 12ms 9ms -1ms -11.1%
Full Refresh 159ms 1184ms 164ms -5ms -3%

Results based on 10 iterations. P50 = median, P95 = 95th percentile.


Legend
  • 🚀 Significant speedup (>100ms faster)
  • ✅ Faster than baseline
  • ➖ No significant change
  • 🔺 Slower than baseline (>100ms)
  • ⚠️ Significant slowdown (>500ms)

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Performance Report (Linux) ✅

Metric PR (P50) PR (P95) Baseline (P50) Delta Change
Server Startup 1ms 1ms 1ms 0ms 0%
Full Refresh 48ms 331ms 55ms -7ms -10.0%

Results based on 10 iterations. P50 = median, P95 = 95th percentile.


Legend
  • 🚀 Significant speedup (>100ms faster)
  • ✅ Faster than baseline
  • ➖ No significant change
  • 🔺 Slower than baseline (>100ms)
  • ⚠️ Significant slowdown (>500ms)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the pet-virtualenvwrapper test suite against intermittent failures caused by temp directory name collisions during parallel execution. It updates the test-only directory naming scheme to remain unique even when the system clock has coarse resolution, while keeping the existing explicit cleanup approach.

Changes:

  • Add a process-local AtomicUsize sequence to guarantee unique test directory names under parallelism.
  • Preserve process ID and timestamp components in the temp directory name for additional uniqueness.
  • Keep existing remove_dir_all-based cleanup behavior in tests.
Show a summary per file
File Description
crates/pet-virtualenvwrapper/src/environments.rs Updates test helper create_test_dir() to include an atomic sequence ID to prevent temp directory collisions during parallel tests.

Review details

  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

@karthiknadig
Karthik Nadig (karthiknadig) merged commit d15f216 into main Aug 5, 2026
37 checks passed
@karthiknadig
Karthik Nadig (karthiknadig) deleted the test/issue-498 branch August 5, 2026 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make virtualenvwrapper test directories collision-proof

4 participants